// index.js
// 获取应用实例
var plugin = requirePlugin("TCShipMain");
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    
    tcshipObj: {
      pluginName: '',
      openId: '',
      mobile: '',
      carPlate: '',
      city: '苏州',
    },
    serialId: ''
  },
  // 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad() {

  },

  goPluginOrder: function(e) {
    this.TMSBridge.navigateToPlugin({
      appId: 'wx381a393cd6daf202',
      url: '/order?serialId=ww600689a3212b01d756'
    })
  },

  
  onNavigateTo(e) {
    debugger
    console.log(e.detail)
  },

  onCancel(e) {},
  onConfirm(e) {},
  onInput(e) {
    this.setData({
      serialId: e.detail.value
    })
  },
  clearSerialId() {

    this.setData({
      serialId: ''
    })
  },
  goOrders() {
    const serialId = this.data.serialId
    if(!serialId) {
      return
    }
    wx.navigateTo({
      url: `plugin://TCShipMain/order?serialId=${serialId}&payType=failed`,
    })
    console.log("plugin: ", plugin)
    // this.TMSBridge.navigateToPlugin({
    //   appId: 'wx381a393cd6daf202',
    //   url: `/order?serialId=${serialId}`
    // })
  }
})
